<template>
  <hc-button plain @click="open">Open a draggable Message Box</hc-button>
  <hc-button plain @click="open2">
    Open a overflow draggable Message Box
  </hc-button>
</template>

<script lang="ts" setup>
import { HcMessage, HcMessageBox } from 'hicor-ui'

const open = () => {
  HcMessageBox.confirm(
    'proxy will permanently delete the file. Continue?',
    'Warning',
    {
      confirmButtonText: 'OK',
      cancelButtonText: 'Cancel',
      type: 'warning',
      draggable: true,
    }
  )
    .then(() => {
      HcMessage({
        type: 'success',
        message: 'Delete completed',
      })
    })
    .catch(() => {
      HcMessage({
        type: 'info',
        message: 'Delete canceled',
      })
    })
}

const open2 = () => {
  HcMessageBox.confirm(
    'proxy will permanently delete the file. Continue?',
    'Warning',
    {
      confirmButtonText: 'OK',
      cancelButtonText: 'Cancel',
      type: 'warning',
      draggable: true,
      overflow: true,
    }
  )
    .then(() => {
      HcMessage({
        type: 'success',
        message: 'Delete completed',
      })
    })
    .catch(() => {
      HcMessage({
        type: 'info',
        message: 'Delete canceled',
      })
    })
}
</script>
